package com.heima.feigins.fallback;


import com.heima.feigins.ApUserFeigin;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.user.pojos.ApUser;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component("adUserFeiginFallback")
@Slf4j
public class ApUserFeiginFallback implements FallbackFactory<ApUserFeigin>{

    @Override
    public ApUserFeigin create(Throwable throwable) {
        return new ApUserFeigin() {
            @Override
            public ResponseResult<ApUser> findApUserById(Integer apUserId) {
                log.info("feigin远程调用出现问题，ApUserFeigin远程调失败");
                return ResponseResult.errorResult(AppHttpCodeEnum.REMOTE_SERVER_ERROR,"远程调用出现错误");
            }
        };
    }
}
